import com.baidu.xuper.api.Account;
import com.baidu.xuper.api.Transaction;
import com.baidu.xuper.api.XuperClient;
import com.baidu.xuper.config.Config;

import java.util.HashMap;
import java.util.Map;

public class JavaSDKDemo {
    public static void main(String[] args) throws Exception {
        //加载配置文件
        Config.setConfigPath("src/main/resources/sdk.yaml");
        //初始化客户端
        XuperClient client = new XuperClient("39.156.69.83:37100");
        //导入账户证书
        Account account = Account.getAccountFromFile("D:/keys","111111");

        account.setContractAccount("XC111111111111111@xuper");

        Map<String, byte[]> map = new HashMap<>();
        map.put("key", "stones".getBytes());

        Transaction tx = client.invokeContract(account, "wasm", "javasdktest", "increase", map);

        System.out.println("response: " + tx.getContractResponse().getBodyStr());
        System.out.println("txId: " + tx.getTxid());

    }
}
